<?php declare(strict_types=1);
/**
 * @author      xianganyall <xianganyall@gmail.com>
 * @copyright   2023-2025 owner
 **/

namespace Srv\Libs\ConfModel;

final class TokenKeyConf extends ConfAbstract
{
    public const PREFIX                         = 'TOKEN.';             // 配置前缀[必定点结尾]
    protected int $renewTime                    = 0;                    // 提前续期时长[秒]
    protected int $expireTime                   = 0;                    // 有效时长[秒]
    protected bool $checkCache                  = false;                // 是否检查缓存
    protected bool $checkDb                     = false;                // 是否检查数据存储
    protected bool $validDevId                  = false;                // 是否验证设备Id
    protected bool $validDevPlatform            = false;                // 是否验证设备平台
    protected string $appId                     = '';                   // 应用ID
    protected string $appSecret                 = '';                   // 应用ID秘钥
    protected array $secretList                 = [];                   // 后备解码应用ID秘钥列表

    /**
     * @param array $confData
     */
    public function __construct(array $confData)
    {
        $this->init($confData);
    }

    /**
     * @return int
     */
    public function getRenewTime(): int
    {
        return $this->renewTime;
    }

    /**
     * @return int
     */
    public function getExpireTime(): int
    {
        return $this->expireTime;
    }

    /**
     * @return bool
     */
    public function isCheckCache(): bool
    {
        return $this->checkCache;
    }

    /**
     * @return bool
     */
    public function isCheckDb(): bool
    {
        return $this->checkDb;
    }

    /**
     * @return bool
     */
    public function isValidDevId(): bool
    {
        return $this->validDevId;
    }

    /**
     * @return bool
     */
    public function isValidDevPlatform(): bool
    {
        return $this->validDevPlatform;
    }

    /**
     * @return string
     */
    public function getAppId(): string
    {
        return $this->appId;
    }

    /**
     * @return string
     */
    public function getAppSecret(): string
    {
        return $this->appSecret;
    }

    /**
     * @return array
     */
    public function getSecretList(): array
    {
        return $this->secretList;
    }
}